<template>
	<view>
		<navbar title="联系客服"></navbar>
		<view class="service-box fa fdc">
			<image class="qrcode" :src="image" mode=""></image>
			<view class="scanadd theme">微信扫码添加客服</view>
			<view class="copy fa jcc aic" @click="copyWechat">
				<image class="wxicon" src="../../static/wechat.png" mode=""></image>
				<view>一键复制微信号</view>
			</view>
		</view>
		<view class="fa jcc fz26 cla">无法添加或疑难问题请联系工作人员</view>
		<view class="service fa jcsb">
			<view class="service-list fa fdc jcc pr">
				<image class="service-icon" src="../../static/service2.png" mode=""></image>
				<view class="fz26">在线客服</view>
				<button open-type="contact"></button>
			</view>
			<view class="fa fdc jcc" @click="phoneContact">
				<image class="service-icon" src="../../static/phone2.png" mode=""></image>
				<view class="fz26">电话联系</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				image: '',
				wechat: '',
				phone: ''
			};
		},
		onLoad() {
			this.getServiceInfo()
		},
		methods: {
			getServiceInfo() {
				this.api.appSettingFunc({
					groupKey: 'kf'
				}).then(res => {
					if(res.code == 200) {
						this.image = res.data.qcCode
						this.wechat = res.data.wechat
						this.phone = res.data.phone
					}
				})
			},
			copyWechat() {
				let wechatNumber = String(this.wechat)
				uni.setClipboardData({
					data: wechatNumber
				})
			},
			phoneContact() {
				let PhoneNumber = String(this.phone)
				uni.makePhoneCall({
					phoneNumber: PhoneNumber
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.service-box{
		margin: 128rpx 98rpx 48rpx;
		border-radius: 10rpx;
		background: #fff;
		.qrcode{
			margin-top: 70rpx;
			width: 368rpx;
			height: 356rpx;
			border: 2rpx solid #eee;
		}
		.scanadd{
			margin: 28rpx 0 52rpx;
		}
		.copy{
			margin: 0 0 74rpx;
			padding: 0 80rpx;
			height: 82rpx;
			border-radius: 40rpx;
			color: #fff;
			background: var(--theme);
			.wxicon{
				margin-right: 14rpx;
				width: 62rpx;
				height: 62rpx;
			}
		}
	}
	.service{
		margin-top: 100rpx;
		padding: 0 168rpx;
		.service-list{
			button{
				position: absolute;
				top: 0;
				left: 0;
				right: 0;
				width: 100%;
				height: 100%;
				opacity: 0;
			}
		}
		.service-icon{
			margin-bottom: 16rpx;
			width: 104rpx;
			height: 104rpx;
		}
	}
</style>
